package com.project.entity.atricle;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import org.apache.commons.lang3.StringUtils;

import com.dtyunxi.dto.BaseDto;
import com.project.common.Constants;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@Entity
@Table(name="B_ARTICLE")
@ApiModel(value="文章信息")
public class Article extends BaseDto{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 8218582620635336603L;

	@ApiModelProperty(value="标题")
	@Column
	private String title;//标题
	
	@ApiModelProperty(value="类别id")
	@Column
	private Long categoryId;//类别id
	
	@ApiModelProperty(value="标签id")
	@Column
	private Long labelId;//标签id
	
	@ApiModelProperty(value="发布时间")
	@Column
	private Date publishTime;//发布时间
	
	@ApiModelProperty(value="访问量")
	@Column
	private Long pageView;//访问量
	
	@ApiModelProperty(value="内容")
	@Column
	private String content;//内容
	
	@ApiModelProperty(value="二维码图片地址")
	@Column
	private String qrcodeUrl;//二维码图片地址
	
	@ApiModelProperty(value="封面图片url")
	@Column
	private String coverPicUrl;//封面图片url
	
	@ApiModelProperty(value="发布状态(N:未发布P:已发布)")
	@Column
	private String publishStatus;//发布状态(N:未发布P:已发布)
	
	@ApiModelProperty(value="创建人")
	@Column
	private String createUser;//创建人
	
	@ApiModelProperty(value="创建时间")
	@Column
	private Date createTime;//创建时间
	
	@ApiModelProperty(value="修改人")
	@Column
	private String updateUser;//修改人
	
	@ApiModelProperty(value="修改时间")
	@Column
	private Date updateTime;//修改时间
	
	@ApiModelProperty(value="是否被当前用户收藏(0:否，1：是)")
	private Integer collection;  //是否被当前用户收藏(0:否，1：是)
	
	@ApiModelProperty(value="封面图片地址")
	public String getRealCoverPicUrl() {
		return StringUtils.isBlank(this.coverPicUrl)?null:Constants.OBJECT_STORAGE_URL_DOWNLOAD_IMAGE + this.coverPicUrl;
	}
	
    /**
     * @return Returns the collection.
     */
    public Integer getCollection() {
        return collection;
    }

    /**
     * @param collection The collection to set.
     */
    public void setCollection(Integer collection) {
        this.collection = collection;
    }

    public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public Long getCategoryId() {
		return categoryId;
	}

	public void setCategoryId(Long categoryId) {
		this.categoryId = categoryId;
	}

	public Long getLabelId() {
		return labelId;
	}

	public void setLabelId(Long labelId) {
		this.labelId = labelId;
	}

    public Date getPublishTime() {
        return publishTime;
    }

    public void setPublishTime(Date publishTime) {
        this.publishTime = publishTime;
    }

    public Long getPageView() {
		return pageView;
	}

	public void setPageView(Long pageView) {
		this.pageView = pageView;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getQrcodeUrl() {
		return qrcodeUrl;
	}

	public void setQrcodeUrl(String qrcodeUrl) {
		this.qrcodeUrl = qrcodeUrl;
	}

	public String getCoverPicUrl() {
		return coverPicUrl;
	}

	public void setCoverPicUrl(String coverPicUrl) {
		this.coverPicUrl = coverPicUrl;
	}

	public String getPublishStatus() {
		return publishStatus;
	}

	public void setPublishStatus(String publishStatus) {
		this.publishStatus = publishStatus;
	}

	public String getCreateUser() {
		return createUser;
	}

	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getUpdateUser() {
		return updateUser;
	}

	public void setUpdateUser(String updateUser) {
		this.updateUser = updateUser;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
}
